package main

import (
	"./kdt"
	"fmt"
	// "html/template"
	// "golang.org/x/net/websocket"
	"net/http"
)

func main() {
	http.HandleFunc("/apis/user/register", kdt.UserRegister)
	http.HandleFunc("/apis/user/login", kdt.UserLogin)
	http.HandleFunc("/apis/admin/register", kdt.AdminRegister)
	http.HandleFunc("/apis/admin/login", kdt.AdminLogin)
	http.HandleFunc("/apis/pack/add", kdt.PackAdd)
	http.HandleFunc("/apis/pack/admin/query/unclaimed", kdt.PackAdminQueryUnclaimedPack)
	http.HandleFunc("/apis/pack/admin/query", kdt.PackAdminQuery)
	http.HandleFunc("/apis/pack/admin/claim", kdt.PackAdminClaim)
	http.HandleFunc("/apis/pack/admin/adddot", kdt.PackAdminAddDeliveryDot)
	http.HandleFunc("/apis/pack/user/query", kdt.PackUserQuery)
	http.HandleFunc("/apis/pack/user/receive", kdt.PackUserReceive)
	http.HandleFunc("/apis/pack/query", kdt.PackQuery)
	http.HandleFunc("/apis/product/queryAll", kdt.ProductQueryAll)
	http.HandleFunc("/apis/product/query", kdt.ProductQuery)

	http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("./views"))))
	e := http.ListenAndServe(":8080", nil)
	if e != nil {
		fmt.Println(e)
	}
}
